<?php
/**
 * This file contains the class PersonView which provides
 * all of the text requirements for the person notices page
 *
 * @copyright  2009 A Memory Tree
 * @license    A Memory Tree License
 */
/**
 * This class provides the text for a person
 *
 * @copyright  2009 A Memory Tree
 * @license    A Memory Tree License
 */
class PersonView
{
    /**
     * A place to store pre-prepared messages
     *
     * @var array[string]string
     */
    private $_text;
    /**
      * The html class that provides helpers to display the text
     *
     * @var Html
     */
    private $_html;
    /**
     * Builds the list of text messages
     * 
     * @return void
     * @param Html &$html
     */
    function __construct(&$html)
    {
        $this->_html = $html;
        $this->_text['test'] = 'A test message';
    }
    /**
     * Return the text that's associated with the given name
     * 
     * @return string
     * @param string $name
     */
    function text($name)
    {
        return $this->_text[$name];
    }
    function aka($aka)
    {
        $html = $this->_html;
        $aka = $html->text($aka);
        return 'Also known as <b>'.$aka.'</b>.'; 
    }
    function nee($nee)
    {
        $html = $this->_html;
        $nee = $html->text($nee);
        return ' '.$nee;
    }
    function former($former)
    {
        $html = $this->_html;
        $former = $html->text($former);
        return " ".$former; 
    }
    function neeAndFormer($nee, $former)
    {
        return '<p>Other Name(s):<b>'.$nee.$former."</b>.</p>";
    }
    function deathDate($deathDate)
    {
        $html = $this->_html;
        $deathDate = $html->text($deathDate);
        return "Died ".$deathDate.". ";
    }
    function age($age, $extra)
    {
        $html = $this->_html;
        $age = $html->text($age);
        $extra = $html->text($extra);
        return 'Age '.$age.$extra;
    }
}
?>